package com.wzy.sxgc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wzy.common.annotation.Log;
import com.wzy.common.core.controller.BaseController;
import com.wzy.common.core.domain.AjaxResult;
import com.wzy.common.enums.BusinessType;
import com.wzy.sxgc.domain.SxgcSxrz;
import com.wzy.sxgc.service.ISxgcSxrzService;
import com.wzy.common.utils.poi.ExcelUtil;
import com.wzy.common.core.page.TableDataInfo;

/**
 * 实习日志Controller
 * 
 * @author wzy
 * @date 2025-10-15
 */
@RestController
@RequestMapping("/sxgc/sxrz")
public class SxgcSxrzController extends BaseController
{
    @Autowired
    private ISxgcSxrzService sxgcSxrzService;

    /**
     * 查询实习日志列表
     */
    @PreAuthorize("@ss.hasPermi('sxgc:sxrz:list')")
    @GetMapping("/list")
    public TableDataInfo list(SxgcSxrz sxgcSxrz)
    {
        startPage();
        List<SxgcSxrz> list = sxgcSxrzService.selectSxgcSxrzList(sxgcSxrz);
        return getDataTable(list);
    }

    /**
     * 导出实习日志列表
     */
    @PreAuthorize("@ss.hasPermi('sxgc:sxrz:export')")
    @Log(title = "实习日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SxgcSxrz sxgcSxrz)
    {
        List<SxgcSxrz> list = sxgcSxrzService.selectSxgcSxrzList(sxgcSxrz);
        ExcelUtil<SxgcSxrz> util = new ExcelUtil<SxgcSxrz>(SxgcSxrz.class);
        util.exportExcel(response, list, "实习日志数据");
    }

    /**
     * 获取实习日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('sxgc:sxrz:query')")
    @GetMapping(value = "/{rzId}")
    public AjaxResult getInfo(@PathVariable("rzId") Long rzId)
    {
        return success(sxgcSxrzService.selectSxgcSxrzByRzId(rzId));
    }

    /**
     * 新增实习日志
     */
    @PreAuthorize("@ss.hasPermi('sxgc:sxrz:add')")
    @Log(title = "实习日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SxgcSxrz sxgcSxrz)
    {
        return toAjax(sxgcSxrzService.insertSxgcSxrz(sxgcSxrz));
    }

    /**
     * 修改实习日志
     */
    @PreAuthorize("@ss.hasPermi('sxgc:sxrz:edit')")
    @Log(title = "实习日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SxgcSxrz sxgcSxrz)
    {
        return toAjax(sxgcSxrzService.updateSxgcSxrz(sxgcSxrz));
    }

    /**
     * 删除实习日志
     */
    @PreAuthorize("@ss.hasPermi('sxgc:sxrz:remove')")
    @Log(title = "实习日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{rzIds}")
    public AjaxResult remove(@PathVariable Long[] rzIds)
    {
        return toAjax(sxgcSxrzService.deleteSxgcSxrzByRzIds(rzIds));
    }
}
